/**
 * HQLCreatorFactory.java
 * 卢晓峰
 * Email：lxf9601@gmail.com
 * QQ：297051898
 * Created by 2010-7-18
 */
package com.autoabacus.core.config.provider;

/**
 * hql 创建器工厂
 * @author 卢晓峰
 */
public class HQLCreatorFactory {

	/** hsql 创建器所在类包 */
	public static final String CREATOR_PACKAGE_PATH = "com.autoabacus.core.config.provider.creator";
	
	/**
	 * 获取 hql 创建器
	 * 如果未获取到则返回null
	 * @param queryCommand 查询指令 select delete ...
	 * @return
	 */
	public static HQLCreator getCreator(String queryCommand) {
		try {
			String className = "HQL" + queryCommand.substring(0, 1).toUpperCase() + queryCommand.substring(1)
								+ "Creator";
			return (HQLCreator) (Class.forName(CREATOR_PACKAGE_PATH + "." + className).newInstance());
		} catch (Exception e) {
			return null;
		}
	}
}
